﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ThoiTrang.Business;
using ThoiTrang.Entities;

public partial class Admin_Admin : System.Web.UI.MasterPage
{
    public System.DateTime startTime;
    public string ActivePage = string.Empty;
    public string CurrentUrl = string.Empty;


    protected void Page_Load(object sender, EventArgs e)
    {
      if (!IsPostBack)
      {

      }

      //xet login hay chua?
      //a_Session ss = null;
      try
      {
        SessionManager.CheckLogin(Request[FOConstants.QSP_CKID], Request.ServerVariables["REMOTE_ADDR"], Server.MapPath(string.Format(FOConstants.FILENAME_CKID)));
        CurrentUrl = Request.Url.ToString();
        if (SessionManager.IsLogged)
        {
          lkLogin.InnerHtml = "Đăng xuất";
          lkLogin.HRef = "../logout.aspx?ckid=" + SessionManager.GetCookie();
        }
        else
        {
          lkLogin.InnerHtml = "Đăng nhập";
          lkLogin.HRef = "../login.aspx?ckid=" + SessionManager.GetCookie();
        }
      }
      catch (Exception ex)
      {
        SessionManager.IsLogged = false;
        lkLogin.InnerHtml = "Đăng nhập";
        lkLogin.HRef = "../login.aspx?ckid=" + SessionManager.GetCookie();
        Response.Redirect(lkLogin.HRef);
      }
    }
}
